import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 10 - 19
 * Time: 17:34
 */
//牛客 幸运的袋子
public class Solution16 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }
            Arrays.sort(arr);
            System.out.println(count(arr, n, 0, 0, 1));
        }
    }
    public static int count(int[] arr, int n, int pos, int sum, int muti) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            sum += arr[i];
            muti *= arr[i];
            if(sum > muti) {
                count = count + 1 + count(arr, n, i + 1, sum, muti);
            }else if(arr[i] == 1) {
                count = count + count(arr, n, i + 1, sum, muti);
            }else {
                break;//递归的结束条件
            }
            sum -= arr[i];//回溯
            muti /= arr[i];
            while (i < n - 1 && arr[i] == arr[i + 1]) {//去重,因为题目说拥有相同号码的球是无区别的
                i++;
            }
        }
        return count;
    }
}
